package day02.Order;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/4/17
 */
public class Order {
    private long orderNumber;  // 订单号
    private User owner;       // 所属用户（关联User类）
    private Goods[] goodsArray; // 商品数组（一对多关联Goods类）

    // 构造方法
    public Order(long orderNumber, User owner, Goods[] goodsArray) {
        this.orderNumber = orderNumber;
        this.owner = owner;
        this.goodsArray = goodsArray;
    }

    // Getter/Setter方法
    public long getOrderNumber() { return orderNumber; }
    public void setOrderNumber(long orderNumber) { this.orderNumber = orderNumber; }

    public User getOwner() { return owner; }
    public void setOwner(User owner) { this.owner = owner; }

    public Goods[] getGoodsArray() { return goodsArray; }
    public void setGoodsArray(Goods[] goodsArray) { this.goodsArray = goodsArray; }

    // 查看商品详情信息（遍历商品数组并调用displayInfo）
    public void goodsDetails() {
            for (int i = 0; i < goodsArray.length; i++) {
                Goods goods = goodsArray[i];
                goods.displayInfo();
            }
    }
}


